package com.jcli._java_swing_入门教程pdf.ch17;

import com.jcli.util.GUIUtil;

import javax.swing.*;
import java.awt.*;

/**
 * @author li
 * @version 1.0
 * @belongsProject novel_20230923
 * @belongsPackage com.jcli._java_swing_入门教程pdf.ch17
 * @className _02_JTextFieldDemo
 * @description TODO  三个单行文本框
 * @createTime 2024-01-24  21:34
 */
public class _02_JTextFieldDemo {
    private static JTextField textField1;

    public static void main(String[] args) {
        GUIUtil.useLNF();

        JFrame frame =new JFrame("Java文本框示例");
        frame.setSize(600,200);

        JPanel jp = new JPanel();
        JTextField textField = new JTextField();
        textField.setText("普通文本框");
        textField1 = new JTextField(28);
        textField1.setFont(new Font("楷体",Font.BOLD,30));
        textField1.setText("指定长度和字体的文本框");
        JTextField jTextField3 = new JTextField(30);
        jTextField3.setText("居中对齐");
        jTextField3.setHorizontalAlignment(JTextField.CENTER);
        jp.add(textField);
        jp.add(textField1);
        jp.add(jTextField3);
        frame.add(jp);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}
